<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <ul>
        <li><router-link to="/home">Home</router-link></li>
        <li><router-link to="/settings/emails">emails</router-link></li>
        <li><router-link to="/settings/profile">profile</router-link></li>
      </ul>
      <router-view></router-view>
    </div>
    <script src="vue.js"></script>
    <script src="vue-router.js"></script>
    <script>
      const Home = {
        template: `<div>Home</div>`,
      };
      const UserSettings = {
        template:`
          <div>
            <h2>UserSettings</h2>
            <router-view></router-view>
            <router-view name="helper"></router-view>
          </div>
        `
      }
      const UserEmailSubscriptions = {
        template:`<div>UserEmailSubscriptions</div>`
      }
      const UserProfile = {
        template:'<div>UserProfile</div>'
      }
      const  UserProfilePreview = {
        template:`<div>UserProfilePreview</div>`
      }
      const routes = [
        { name: "home", path: "/home", component: Home },
        {
          path:'/settings',
          component:UserSettings,
          children:[
            {
              path:'emails',
              component:UserEmailSubscriptions
            /*   components:{
                default:UserEmailSubscriptions
              } */
            },
            {
              path:'profile',
              components:{
                default:UserProfile,
                helper: UserProfilePreview
              }
            }
          ]
        }
      ];

      var router = new VueRouter({
        routes,
      });
      var vm = new Vue({
        el: "#app",
        router,
      });
    </script>
  </body>
</html>
